-
Notifications
You must be signed in to change notification settings - Fork 416
Refactor place.cpp Part III #1543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vaughnbetz
merged 2 commits into
verilog-to-routing:master
from
Bill-hbrhbr:RefactorPlaceCpp
Sep 15, 2020
Merged
Refactor place.cpp Part III #1543
vaughnbetz
merged 2 commits into
verilog-to-routing:master
from
Bill-hbrhbr:RefactorPlaceCpp
Sep 15, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… routines to faciliate code modularization. Added documentation and cleaned up the argument list of related routines.
Bill-hbrhbr
commented
Sep 15, 2020
Comment on lines
+281
to
+312
void t_placer_statistics::reset() { | ||
av_cost = 0.; | ||
av_bb_cost = 0.; | ||
av_timing_cost = 0.; | ||
sum_of_squares = 0.; | ||
success_sum = 0; | ||
success_rate = 0.; | ||
std_dev = 0.; | ||
} | ||
|
||
void t_placer_statistics::single_swap_update(const t_placer_costs& costs) { | ||
success_sum++; | ||
av_cost += costs.cost; | ||
av_bb_cost += costs.bb_cost; | ||
av_timing_cost += costs.timing_cost; | ||
sum_of_squares += (costs.cost) * (costs.cost); | ||
} | ||
|
||
void t_placer_statistics::calc_iteration_stats(const t_placer_costs& costs, int move_lim) { | ||
if (success_sum == 0) { | ||
av_cost = costs.cost; | ||
av_bb_cost = costs.bb_cost; | ||
av_timing_cost = costs.timing_cost; | ||
} else { | ||
av_cost /= success_sum; | ||
av_bb_cost /= success_sum; | ||
av_timing_cost /= success_sum; | ||
} | ||
success_rate = success_sum / float(move_lim); | ||
std_dev = get_std_dev(success_sum, sum_of_squares, av_cost); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to add function level descriptions to these. Will do it in the future.
Nice refactoring Bill. Cleaner and much better commented than what was there before. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
#1529
#1534 (Discussion) #1542 (Merge)
(This PR):
(1. pass by arguments)
(2. move it into the placer global context)
Future PR ideas:
Motivation and Context
Refactor place.cpp to modularize it and reduce its length and complexity.
Types of changes